/*
	Anonymous Image Board Image Downloader - program for downloading pictures from AIB
	Copyright (C) 2011-2012 Metallhead <Metallhead@megabox.ru>

	HomePage:    http://code.google.com/p/aibid/

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef XMLEDITOR_H
#define XMLEDITOR_H

#include <QDialog>
#include <downloads.h>
#include <QXmlStreamWriter>
#include "common.h"
#include <QInputDialog>

namespace Ui {
    class XmlEditor;
}

class XmlEditor : public QDialog
{
    Q_OBJECT

public:
    explicit XmlEditor(QWidget *parent = 0);
    ~XmlEditor();

private slots:
	void on_moveHigher_clicked();
	void on_tableWidget_currentCellChanged(int currentRow, int, int, int);
	void on_moveLower_clicked();
	void on_detector_textEdited(QString);
	void on_siteName_clicked();
	void on_addOver_clicked();
	void on_addUnder_clicked();
	void on_deleteDetector_clicked();
	void on_buttonBox_accepted();
	void applyButtonClicked();

	void on_files_currentIndexChanged(const QString &arg1);

	void on_addFile_clicked();

	void on_deleteFile_clicked();

private:
    Ui::XmlEditor *ui;
	void moveRow(bool up);
	void insertRow(int row);
	bool edited;
	bool hocusPocus;
	void saveAll();
	int currentFile;
	QVector<detectorStruct> localDetectors;
	void readLocalDetectors(QString fileName);
	void changeEditedState(bool edit);
	void checkForbiddenName();
};

#endif // XMLEDITOR_H
